#include "bullet.h"

bullet::bullet()
{
    m_bullet.load(":/res/bullet1.png");

    m_X=512*0.5-m_bullet.width()*0.5;
    m_Y=768;
    m_Free=true;
    m_Speed=5;

    m_Rect.setWidth(m_bullet.width());
    m_Rect.setHeight(m_bullet.height());
    m_Rect.moveTo(m_X,m_Y);
}
void bullet::updatePosition(){
    if(m_Free){
        return;
    }

    m_Y-=m_Speed;
    m_Rect.moveTo(m_X,m_Y);

    if(m_Y<=-m_Rect.height()){
        m_Free=true;
    }
}
